package com.surelution.projects.echo.domain

class Blog {
	
	private static final String TYPE_NEW = "NEW"

    static constraints = {
		type blank :true
    }
	
	static mapping = {
		id generator : "uuid.hex"
		content type:'text'
	}
	
	static transients = ["typeDesc"]
	
	static hasMany = [comments:Comment]
	
	def beforeInsert = {
		createTime = new Date()
	}
	
	String id
	String title
	String content
	String type
	Date createTime
	
	String getTypeDesc() {
		Status.findByKey(type)?.label
	}
}
